function trained = train( population )
    global probTraining epochsTraining;
    
    trained=population;
    
    for i = 1:length(population.individuals)
        if rand() < probTraining
            trained.individuals{i} = trainNeuralNetwork(population.individuals{i},epochsTraining); 
            trained.fitness(i) = main(trained.individuals{i}); 
            %sprintf('entrene una red el fitness antes era %g y ahora es %g', population.fitness(i), trained.fitness(i))
        end
    end
end

